<?php 
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
MYDCONN();
$GLOBALS['MYT']=$GLOBALS['MYD'];
	if (!isset($_POST['User'])){$_POST['User']=0;}
	if (!isset($_POST['Office'])){$_POST['Office']=1;}
	 mn_field('select','ED','User',$_POST['User'],"SELECT main_users.ref AS ID, main_users.name AS NAME
	  			FROM main_users
				LEFT OUTER JOIN hrs_users ON main_users.ref = hrs_users.User
				WHERE main_users.Type IN (2,3,5) AND (main_users.ref_office = {$_POST['Office']} OR hrs_users.ref_office = {$_POST['Office']})
				AND main_users.Type IN (2,5)
				GROUP BY main_users.ref
				ORDER BY main_users.name",' ','','');